package com.shuwen.gcdj.controller.report;

import com.shuwen.gcdj.bean.equipmentMaintenance.request.EquipmentMaintainReportReq;
import com.shuwen.gcdj.bean.equipmentMaintenance.request.EquipmentPeriodReq;
import com.shuwen.gcdj.bean.equipmentMaintenance.response.EquipmentMaintainReportResp;
import com.shuwen.gcdj.bean.equipmentMaintenance.response.EquipmentOpsTotalReportResp;
import com.shuwen.gcdj.common.annotation.JWTAuth;
import com.shuwen.gcdj.common.api.CommonResult;
import com.shuwen.gcdj.service.report.EquipmentMainTainReportService;
import com.shuwen.gcdj.service.report.EquipmentMaintenanceReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 设备运维报表
 * @author XYC
 */
@Api(tags = "设备运维报表")
@RestController
@RequestMapping("/report")
@Slf4j
public class EquipmentMaintenanceController {

    @Autowired
    private EquipmentMainTainReportService equipmentMainTainReportService;

    @Autowired
    private EquipmentMaintenanceReportService equipmentReportService;


    @ApiOperation(value = "区域运维表表")
    @PostMapping(value = "/getEquipmentMaintainReportData")
    @JWTAuth
    public CommonResult<EquipmentMaintainReportResp> getEquipmentMaintainReportData(@RequestBody @Valid EquipmentMaintainReportReq req,BindingResult bindingResult){
        return equipmentMainTainReportService.getEquipmentMaintainReportData(req);
    };


    @ApiOperation(value = "设备运维报表")
    @PostMapping(value = "/getEquipmentOpsTotalReport")
    @JWTAuth
    public CommonResult<EquipmentOpsTotalReportResp> getEquipmentOpsTotalReport(@RequestBody @Valid EquipmentPeriodReq req, BindingResult bindingResult){
        return CommonResult.success(equipmentReportService.getEquipmentOpsTotalReport(req));
    };
}
